home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Internet
/
Collection of Internet.iso
/
infosrvr
/
doc
/
www_talk.arc
/
000182_connolly@pixel.convex.com _Thu Jul 16 05:50:02 1992.msg
< prev
next >
Wrap
Internet Message Format
|
1992-11-30
|
2KB
Return-Path: <connolly@pixel.convex.com>
Received: from dxmint.cern.ch by nxoc01.cern.ch (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0)
id AA05332; Thu, 16 Jul 92 05:50:02 MET DST
Received: by dxmint.cern.ch (dxcern) (5.57/3.14)
id AA05889; Thu, 16 Jul 92 05:49:45 +0200
Received: from pixel.convex.com by convex.convex.com (5.64/1.35)
id AA25548; Wed, 15 Jul 92 22:49:23 -0500
Received: from localhost by pixel.convex.com (5.64/1.28)
id AA25229; Wed, 15 Jul 92 22:49:22 -0500
Message-Id: <9207160349.AA25229@pixel.convex.com>
To: www-talk@nxoc01.cern.ch
Subject: perl script to legalize HTML files
Date: Wed, 15 Jul 92 22:49:21 CDT
From: Dan Connolly <connolly@pixel.convex.com>
#!/usr/local/bin/perl
#
# USE
# fix-html.pl <W3-file.html >W3-file.sgml
#
# SEE ALSO
# the html.dtd.
#
print "<!DOCTYPE HTML SYSTEM>\n";
@html = <>; # read whole file
$_ = join('', @html);
while(/</){
&out($`);
$_ = $';
if(s/^A\s+//i){
&fix_anchor;
}elsif(s/^NEXTID\s+(\d+)\s*>//){
&out("<NEXTID N=$1>");
}else{
&out('<');
}
}
&out($_);
sub out{
print $_[0];
}
sub fix_anchor{
local($name, $href, $type);
# What exactly is the syntax of an SGML attribute value?
while(s/^(\w+)\s*=\s*((\"[^\"]*\")|([^\s>]+))\s*//){
local($v) = ($3 || $4);
local($a) = $1;
$href = $v if $a =~ /^href$/i;
$name = $v if $a =~ /^name$/i;
$type = $v if $a =~ /^type$/i;
}
s/[^>]*>//;
&out("<A");
&out(" NAME=\"$name\"") if $name ne '';
&out(" TYPE=\"$type\"") if $type ne '';
&out(" HREF=\"$href\"") if $href ne '';
&out(">");
}